package com.vf.admin.client.service.impl;

import com.vf.admin.client.dao.AppEarningsDao;
import com.vf.admin.client.service.AppEarningsService;
import com.vf.admin.common.splitpage.SplitPageBean;
import com.vf.admin.miaodong.entity.AppEarnings;
import com.vf.admin.miaodong.entity.AppUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 收益明细
 */
@Service
public class AppEarningsServiceImpl implements AppEarningsService {

    @Autowired
    AppEarningsDao appEarningsDao;

    @Override
    public List<AppEarnings> list(Map<String, Object> paraMap, SplitPageBean splitPage) {
        return appEarningsDao.list(paraMap, splitPage);
    }

    @Override
    public List<AppEarnings> list(Map<String, Object> paraMap) {
        return appEarningsDao.list(paraMap);
    }

    @Override
    public AppEarnings get(Integer id) {
        return appEarningsDao.get(id);
    }

    @Override
    public void save(AppEarnings haoYou) {
        appEarningsDao.save(haoYou);
    }

    @Override
    public void zhangdanSave(String neirong, double money, Integer type, Integer leixing, Integer shouyi, AppUser user, Integer num, String giftname, String giftpic) {
        AppEarnings earnings=new AppEarnings();
        earnings.setCreatetime(new Date());
        earnings.setMoney(money);
        earnings.setNeirong(neirong);
        earnings.setType(type);
        earnings.setLeixing(leixing);
        earnings.setShouyi(shouyi);
        earnings.setNick(user.getNick());
        earnings.setPhone(user.getLoginname());
        earnings.setPic(user.getPic());
        earnings.setNum(num);
        earnings.setGiftname(giftname);
        earnings.setGiftpic(giftpic);
        appEarningsDao.save(earnings);
    }

    @Override
    public void del(Integer id) {
        appEarningsDao.del(id);
    }
}
